package be.xios.projectquiz.statuspanels;

import java.awt.Color;
import java.awt.Font;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.RenderingHints;

import javax.swing.JPanel;

/// <summary>
/// Deze klasse is een jpanel waarop de serverstatus gedisplayed word ip/port
/// </summary>
/// <author>Sebastian Kubski</author>
@SuppressWarnings("serial")
public class ServerStatusPanel extends JPanel{

	private String serverIP;
	private Color matrixKleur;
	
	public ServerStatusPanel(String serverIP, Color matrixKleur) {
		this.serverIP=serverIP;
		this.matrixKleur=matrixKleur;
	}
	
	public void paintComponent(Graphics g) {
		super.paintComponent(g);	
		this.setBackground(Color.BLACK);
		
		Graphics2D g2D=(Graphics2D) g;		
		g2D.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);		

		g2D.setColor(matrixKleur);
		g2D.setFont(new Font("Arial", Font.BOLD, 12));
		
		g2D.drawRoundRect(2, 2, this.getWidth() - 5, this.getHeight() - 5, 5 , 5);
		
		g2D.drawString("Server IP" 	 , 7 , 30);
		g2D.drawString("Server PORT" , 7 , 50);
		
		for (int i = 0; i < 2; i++) {
			g2D.drawString(":", 100, 30+(i*20));
		}
		
		g2D.drawString(serverIP    , 105 , 30);
		g2D.drawString("5000"      , 105 , 50);
	}
}
